package com.itheima.reggie.common;

/*
* 公共类
* 通过ThreadLocal,存储同一线程中公共数据
* */
public class BaseContext {
    //用户登录ID
    private static final ThreadLocal<Long> THREAD_LOCAL_USER_ID = new ThreadLocal();


    /**
     * 设置值
     * @param id
     */
    public static void setCurrentId(Long id){
        THREAD_LOCAL_USER_ID.set(id);
    }

    /**
     * 获取值
     * @param
     * @return
     */
    public static Long getCurrentId(){
        return THREAD_LOCAL_USER_ID.get();
    }
}
